/*
 * @Author: LIFM0623 1944099171@qq.com
 * @Date: 2024-01-11 15:16:44
 * @LastEditors: EyeSklear 1814580085@qq.com
 * @LastEditTime: 2024-05-15 19:17:08
 * @FilePath: \Scene_Back\src\email\email.module.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Module } from '@nestjs/common';
import { EmailService } from './email.service';
import { EmailController } from './email.controller';
import { MailerModule } from '@nestjs-modules/mailer';
import { EjsAdapter } from '@nestjs-modules/mailer/dist/adapters/ejs.adapter';
import * as path from 'path';
import { ConfigModule } from '@nestjs/config';

@Module({
  imports: [
    MailerModule.forRoot({
      transport: {
        host: 'smtp.qq.com', //邮箱服务器地址
        port: 587, //服务器端口 默认 465
        auth: {
          // user: '1437792521@qq.com',
          // // pass: "afmembbvackwdjef",
          // pass: 'swmqtdtjweqchgjc',
          user: '1312160759@qq.com',
          pass: 'obwurmbmsirhbaef'
        },
      },
      preview: false, //是否开启预览，开启了这个属性，在调试模式下会自动打开一个网页，预览邮件
      defaults: {
        // from: '1437792521@qq.com', //发送人 你的邮箱地址
        from: '1312160759@qq.com', //发送人 你的邮箱地址
      },
      template: {
        dir: path.join(process.cwd(), './src/email/template'), //这里就是你的ejs模板文件夹路径
        adapter: new EjsAdapter(),
        options: {
          strict: true, //严格模式
        },
      },
    }),
    ConfigModule,
  ],
  controllers: [EmailController],
  providers: [EmailService],
  exports: [EmailService],
})
export class EmailModule {}
